package com.bjsxt.controller;

import com.bjsxt.pojo.Position;
import com.bjsxt.service.PositionService;
import com.bjsxt.service.impl.PositionServiceImpl;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/sxt/PositionServlet")
public class PositionServlet extends  BaseServlet {

    private PositionService positionService=new PositionServiceImpl();

    protected void positionFindAll(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        List<Position> list = positionService.findAll();

        String json = new Gson().toJson(list);
        resp.getWriter().print(json);

    }
}
